﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236

namespace HoloJson.MiniDriver
{
    public sealed partial class BuilderDemoControl : UserControl
    {
        private readonly BuilderDemoDriver demoDriver = new BuilderDemoDriver();

        public BuilderDemoControl()
        {
            this.InitializeComponent();

            // temporary
            ButtonSerialize.Background = new SolidColorBrush(Colors.Navy);
            // ...
        }

        private async void ButtonSerialize_Click(object sender, RoutedEventArgs e)
        {
            // temporary
            var jsonStr = await demoDriver.RunTestBuild();

            TextBoxOutputJSON.Text = jsonStr;


            // TBD:
            // Write the content to a file
            // ....
        }

        private void ButtonOpen_Click(object sender, RoutedEventArgs e)
        {
            // If JSON is written to a file,
            // Open it in response to the user button click...
        }
    }
}
